<?php
include_once '../../mainfile.php';
include (XOOPS_ROOT_PATH . "/header.php"); 
?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="<?PHP echo XOOPS_URL . "modules/local_news/include/rss1html.xsl"; ?>"?>
<rss version="2.0">
  <channel>
    <title><?PHP echo $xoopsModuleConfig['stationLetters'] . '-FM Local News Podcasts'; ?></title>
    <link><?PHP echo XOOPS_URL; ?></link>
    <description><?PHP echo $xoopsModuleConfig['stationLetters'];?> - Public Broadcasting</description>
    <language>en-us</language>

    <copyright><?PHP echo "Copyright ".date("Y"). " " .$xoopsModuleConfig['stationLetters']."-FM"; ?></copyright>
    <pubDate><?PHP echo date("D, d M Y H:i:s"); ?></pubDate>

    <category>News Media - Radio Broadcasting</category>
    <generator><?PHP echo $xoopsModuleConfig['stationLetters']; ?> Website</generator>
    <ttl>30</ttl>
    
<?PHP
$result = $xoopsDB->query("SELECT ID, tease, publish_date, headline, soundfile, dateline FROM " . $xoopsDB->prefix("local_news_stories") . " ORDER BY publish_date DESC LIMIT " . $xoopsModuleConfig['NISL'] . "");
if ($result) {
	$properties = array ();
	while ($myrow = $xoopsDB->fetchArray($result)) {
		echo "    <item>\n";
		echo "        <title>" . html_entity_decode($myrow['headline'], ENT_QUOTES, 'UTF-8') . "</title>\n";
		echo "        <link>" . XOOPS_URL . '/modules/local_news/index.php?op=sideBlock&amp;ID=' . $myrow['ID'] . "</link>\n";
		echo "        <description>Broadcast: " . date("m/d/Y", $myrow['publish_date']) . "</description>\n";
		echo "        <author>" . $xoopsModuleConfig['stationLetters'] . "-FM" . "</author>\n";
		echo "        <enclosure url=\"" . XOOPS_URL . "/modules/local_news/media/audio/" . $myrow['soundfile'] . "\" length=\"" . filesize(XOOPS_ROOT_PATH . "/modules/local_news/media/audio/" . $myrow['soundfile']) . "\"  type=\"audio/mpeg\" />\n";
		echo "        <comments>" . XOOPS_URL . '/modules/local_news/index.php?op=sideBlock&amp;ID=' . $myrow['ID'] . "</comments>\n";
		echo "        <guid>".XOOPS_URL . '/modules/local_news/index.php?op=sideBlock&amp;ID=' . $myrow['ID']."</guid>\n";
		echo "        <pubDate>".date("D, d M Y H:i:s",$myrow['publish_date'])."</pubDate>\n";
		echo "        <source url=\"".XOOPS_URL . "/modules/local_news/index.php\">".$xoopsModuleConfig['stationLetters']."&lt;FM"."</source>\n";
		echo "    </item>";
	}

}
?>    
  </channel>
</rss>